<template>
  <el-select :value="value" :placeholder="placeholder" :clearable="clearable" @input="handleInput">
    <el-option v-for="item in dict" :key="item.value" :label="$t('dictionary.'+item.label)" :value="item.value">
    </el-option>
  </el-select>
</template>
<script>
  export default {
    name: 'DictSelect',
    props: {
      dict: {
        type: Array,
        default () {
          return []
        }
      },
      value: {
        type: Number || String,
        default: null
      },
      clearable: {
        type: Boolean,
        default: false
      },
      placeholder: {
        type: String,
        default: null
      }
    },
    methods: {
      handleInput(v) {
        this.$emit('input', v)
        this.$emit('change', v)
      }
    }
  }

</script>
